"""
URL configuration for robotunits project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from django.conf.urls.static import static

from configs import settings
from apps.area.views import AreaViewSet
from apps.jobs.views import PersonViewSet
from apps.subscriptions.views import SubscriptionViewSet
from apps.articles.views import ArticleViewSet
from apps.products.views import CategoryViewSet, ProductViewSet
from configs.yasg import schema_view

# 创建一个路由器实例
router = DefaultRouter()
router.register(r'subscription', SubscriptionViewSet, basename='subscription')
router.register(r'article', ArticleViewSet, basename='article')
router.register(r'category', CategoryViewSet, basename='category')
router.register(r'product', ProductViewSet, basename='product')
router.register(r'area', AreaViewSet, basename='area')
router.register(r'jobs/concatour/index.html', PersonViewSet, basename='jobs')


urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include(router.urls)),
    path("ckeditor5/", include('django_ckeditor_5.urls')),
    # 接口文档
    path('68/docs/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
